package xhwl.hmo.mall.http.api;


import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.hmo.mall.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017/1/16.
 */

public class UpdateAddressApi extends BaseApi {
    UpdateAddressReq req;
    public UpdateAddressApi(String recordId,String member_mobile, String sh_name, String sh_mobile, String province_id, String city_id, String district_id, String sh_address){
        req=new UpdateAddressReq(recordId,member_mobile,sh_name,sh_mobile,province_id,city_id,district_id,sh_address);
    }

    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).updateAddress(requestBody);
    }
    public class UpdateAddressReq {
        private String member_mobile;
        private String sh_name; // 联系人名称
        private String sh_mobile; // 联系人手机号
        private String province_id; //省id
        private String city_id; // 市id
        private String district_id; //县id
        private String sh_address; //地址详情
        private String sh_yb; // 邮编
        private String record_id;
        public UpdateAddressReq(String recordId,String member_mobile, String sh_name, String sh_mobile, String province_id, String city_id, String district_id, String sh_address) {
            this.member_mobile = member_mobile;
            this.sh_name = sh_name;
            this.sh_mobile = sh_mobile;
            this.province_id = province_id;
            this.city_id = city_id;
            this.district_id = district_id;
            this.sh_address = sh_address;
            this.sh_yb = sh_yb;
            this.record_id=recordId;
        }
    }
}
